function [b, q] = bayes(a, p)
    [n, m] = size(p);
    b = a * p;
    
    q = zeros(m, n);
    d = q;
    for j = 1:m; d(j,:) = a / b(j); end
    q = p' .* d;
end
